package com.restaurant.application.shoplist.support;

import com.nebutown.base.ViewSpec;
import com.nebutown.base.data.ViewUpdate;
import com.nebutown.description.data.UnitForGeneration;
import com.nebutown.generation.PickableBean;
import com.nebutown.generation.basictype.StringData;
import com.nebutown.generation.basictype.UID;
import com.nebutown.supporthome.AbstractBase;
import com.nebutown.supporthome.CmdCapsule;
import com.restaurant.application.shoplist.ShopListImpl;

public class ShopListBase extends AbstractBase {
    private UnitForGeneration desc = new UnitForGeneration();

    public AbstractShopList getImpl() {
        AbstractShopList inst = new ShopListImpl();
        inst.setBase(this, getEscort());
        return inst;
    }

    @Override
    public ShopListOutFace getUnitFace() {
        return new ShopListOutFace(this);
    }

    @Override
    protected Object callDistr(String name, Object... param) {
        switch (name) {
            case "findAllShopData":
                return getImpl().findAllShopData();
            case "findAllShop":
                return getImpl().findAllShop();
            case "checkMaxId":
                return getImpl().checkMaxId();
            case "findShopByName":
                return getImpl().findShopByName((String) param[0]);
            case "addShop":
                getImpl().addShop((UID) param[0]);
                return "";
            case "findAllShopBO":
                return getImpl().findAllShopBO();
            case "getId":
                return getImpl().getId();
            case "getFullView":
                setIsRefresher();
                return getImpl().getFullView();
            case "getViewLead":
                return getImpl().getViewLead((ViewSpec) param[0]);
            case "getEffectiveInterface":
                return getImpl().getEffectiveInterface();
        }
        return null;
    }

    @Override
    protected boolean authDistr(String name) {
        switch (name) {
        }
        return true;
    }

    @Override
    public CmdCapsule getUICall(int cmd) {
        switch (cmd) {
            case 0:
                return AbstractShopList.CMD_INSERT;
            case 1:
                return AbstractShopList.CMD_SEARCH;
            case 2:
                return AbstractShopList.CMD_DETAIL;
            case 3:
                return AbstractShopList.CMD_EDIT;
            case 4:
                return AbstractShopList.CMD_DELETE;
            case 5:
                return AbstractShopList.CMD_SWITCHPAGE;
        }
        return null;
    }

    @Override
    public ViewUpdate uiCall(int cmd, PickableBean param, int... seq) {
        switch (cmd) {
            case 0:
                return getImpl().insert(seq);
            case 1:
                return getImpl().search((ShopListPageVo) param, seq);
            case 2:
                return getImpl().detail(seq);
            case 3:
                return getImpl().edit(seq);
            case 4:
                return getImpl().delete(seq);
            case 5:
                return getImpl().switchPage((StringData) param, seq);
        }
        return null;
    }
}
